<template>
    <div>
        <!-- <h3>当前最新的count值为:{{this.$store.state.count}}</h3> -->
        <h3>{{$store.getters.showNum}}</h3>
        <button @click="handlebtnClick1">+1</button>
        <button @click="handlebtnClick2">+n</button>
        <button @click="handlebtnClick3">+1 Async</button>
        <button @click="handlebtnClick4">+n Async</button>
        <p>你就是个寄吧</p>
    </div>
</template>

<script>
export default {
    data(){
        return {

        }
    },
    methods:{
        handlebtnClick1(){
            this.$store.commit('add')
        },
        handlebtnClick2(){
            this.$store.commit('addN',3)
        },
        //异步count加一
        handlebtnClick3(){
            this.$store.dispatch('addAsync')
        },
        handlebtnClick4(){
            this.$store.dispatch('addNasync',3)
        }
    }
}
</script>